package me.minecraft.plugin.pokemondenyconvert.util;

import com.cobblemon.mod.common.pokemon.Pokemon;
import lombok.Getter;

import java.util.List;

/**
 * 支持白名单与黑名单的宝可梦过滤器
 *
 * @author langle__
 * @version 1.0
 */
@Getter
public class PokemonList {

    private final PokemonFilter whitelist;
    private final PokemonFilter blacklist;

    public PokemonList(List<String> whiteList, List<String> blackList) {
        this.whitelist = new PokemonFilter(whiteList);
        this.blacklist = new PokemonFilter(blackList);
    }

    /**
     * 判断给定的宝可梦是否符合当前的黑白名单规则
     *
     * @param pokemon 待检查的宝可梦对象
     * @return 如果宝可梦符合规则（不在黑名单上且在白名单上或白名单为空），则返回true；否则返回false
     */
    public boolean matches(Pokemon pokemon) {
        if (!whitelist.isEmpty() && whitelist.matches(pokemon)) return true;
        if (blacklist.isEmpty()) return true;
        return blacklist.matches(pokemon);
    }

}
